#include "MephistoCAM.h"

#define REG_NUM 5

int main( int argc, char *argv[] ){

    float regs_float[REG_NUM] = {2.3, 4.5, 3.14159, 99.9, -23.0};
    uint32_t regs_float_bin[REG_NUM] = {0};

    int i;
    for( i=0; i<REG_NUM; i++ ){
        getFloatBin_uint32(regs_float[i], &regs_float_bin[i]);
    }

    int fd = open("/dev/mem", O_RDWR | O_SYNC);

    uint *fptr = mmap(NULL, 10, PROT_READ | PROT_WRITE, MAP_SHARED, fd, ADDR_Float_Point_CTRL);
    uint *GPIO_FP_CTRL = fptr;      // 0x41220000
    uint *GPIO_FP_DATA = fptr + 2;  // 0x41220008

    Config_Float_Regs_PL(   GPIO_FP_CTRL,
                            GPIO_FP_DATA,
                            REG_NUM,
                            regs_float_bin );

    munmap(fptr,10);

    close(fd);

    return 0;
}
